package com.itheima.thread.blockingqueue.demo01;

import java.util.concurrent.ArrayBlockingQueue;

public class BlockingQueueDemo01 {

    public static void main(String[] args) throws InterruptedException {

        ArrayBlockingQueue<String> arrayBlockingQueue = new ArrayBlockingQueue<String>(2);

        arrayBlockingQueue.put("hello");
        arrayBlockingQueue.put("world");

        System.out.println(arrayBlockingQueue);

        System.out.println("--------------------------------------------------");

        String take = arrayBlockingQueue.take();
        System.out.println(take);

        take = arrayBlockingQueue.take();
        System.out.println(take);

        System.out.println("--------------------------------------------------");

        take = arrayBlockingQueue.take();
        System.out.println(take);

    }

}
